/**
 * Created by Administrator on 2017/7/5 0005.
 */
$(function () {
    var ul = $('#slide');
    $('.tut_span1').on('click',function () {
        var num = parseInt(ul.attr('num'));
        var new_num = num-300;
        if(num != -600){
            ul.animate({marginLeft:new_num},600, function () {
                ul.attr('num',new_num);
            });
        }else{ul.animate({marginLeft:0},function () {
            ul.attr('num',0);
        });
        }
    })

    $('.tut_span2').on('click',function () {
        var num = parseInt(ul.attr('num'));
        var new_num = num+300;
        if(num != 0){
            ul.animate({marginLeft:new_num},600, function () {
                ul.attr('num',new_num);
            });
        }else{
            ul.animate({marginLeft:-600},function () {
                ul.attr('num',-600);
            });
        }
    })


    $('.submit').click(function(){
        var names = $('.name_02').val();
        var tel = $('.tel_02').val();
        var tel_zz = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
        if(names == ''){
            alert('姓名不能为空！');
            return false;
        }else if(tel == ''){
            alert('电话不能为空！');
            return false;
        }else if(!tel_zz.test(tel)){
            alert('电话格式错误！');
            return false;
        }else{
            return true;   
        }
    });
})
